Conversation
…date HuggingFaceAPIChatGenerator to start following new StreamingChunk
| tool_call: Optional[ToolCallDelta] = None | ||
| tool_call_result: Optional[ToolCallResult] = None |
There was a problem hiding this comment.
I thought about making
content = Union[str, ToolCallDelta, ToolCallResult]but this would be a breaking change b/c users expect content to always be a string. And this breaks StreamingChunk to ChatMessage implementations (mostly in private methods).
Pull Request Test Coverage Report for Build 15485894448Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
|
Looks very good to me already. 👍 |
…openai dataclass anymore
| index=len(tool_messages) - 1, | ||
| tool_call_result=tool_messages[-1].tool_call_results[0], | ||
| start=True, |
There was a problem hiding this comment.
In ToolInvoker the whole ToolCallResult is always sent so start is always True and index is just the current message index.
…ck into update-streaming-chunk
|
Failing tests are fixed with this PR #9457 |
julian-risch
left a comment
There was a problem hiding this comment.
Looks quite good to me already! 👍 I have only minor comments and regarding Optional[bool] for start in StreamingChunk, I would like to better understand what the meaning of None would be.
Co-authored-by: Julian Risch <julian.risch@deepset.ai>
Co-authored-by: Julian Risch <julian.risch@deepset.ai>
julian-risch
left a comment
There was a problem hiding this comment.
Thanks for addressing the change requests! Another two small change requests and then the PR is ready to be merged!
Related Issues
StreamingChunkto havetool_call,tool_result,startandindex#9358Proposed Changes:
Updated StreamingChunk to add the fields
tool_call,tool_call_result,index, andstartto make it easier to format the stream in a streaming callback.StreamingChunk.tool_callfield to reflect that the arguments can be a string delta.print_streaming_chunkand_convert_streaming_chunks_to_chat_messageutility methods to use these new fields. This especially improves the formatting when usingprint_streaming_chunkwith Agent.OpenAIGenerator,OpenAIChatGenerator,HuggingFaceAPIGenerator,HuggingFaceAPIChatGenerator,HuggingFaceLocalGeneratorandHuggingFaceLocalChatGeneratorto follow the new dataclasses.ToolInvokerto follow the StreamingChunk dataclass.How did you test it?
OpenAIChatGeneratorBefore Changes

After Changes
[ASSISTANT]headerNotes for the reviewer
Just as a heads up ~450 lines of code change from the tests so don't bee too alarmed by the large PR.
Checklist
fix:,feat:,build:,chore:,ci:,docs:,style:,refactor:,perf:,test:and added!in case the PR includes breaking changes.